package com.example.shop.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.time.LocalDateTime;

import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
* <p>
* 浏览历史
* </p>
*
* @author 作者
* @since 2022-05-29
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("r_user_browse_history")
public class UserBrowseHistory extends Model<UserBrowseHistory> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "user_id", type = IdType.ASSIGN_ID)
    //进行浏览的用户id
    private Long userId;
    //浏览的商品
    private Long goodsId;
    //浏览时间
    private LocalDateTime browseDate;

    public UserBrowseHistory(long userId,long goodsId){
        this.userId = userId;
        this.goodsId = goodsId;
        this.browseDate  = LocalDateTime.now();
    }

    @Override
    public String toString() {
        return "UserBrowseHistory{" +
                "userId=" + userId +
                ", goodsId=" + goodsId +
                ", browseDate=" + browseDate +
                '}';
    }
}
